Skip to content
This repository was archived by the owner on Oct 6, 2026. It is now read-only.

Add application credit - #457

Merged
Paulinakhew merged 5 commits into
masterfrom
paulinakhew-add-applicationcredit
Feb 10, 2021
Merged

Paulinakhew merged 5 commits into
masterfrom
paulinakhew-add-applicationcredit

Conversation

@Paulinakhew

@Paulinakhew Paulinakhew commented Feb 8, 2021 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Fixes #343

WHAT is this pull request doing?

Checklist

  • I have updated the CHANGELOG (if applicable)
  • I have followed the Shopify Python guide

@Paulinakhew
Paulinakhew marked this pull request as draft February 8, 2021 22:02
@Paulinakhew
Paulinakhew marked this pull request as ready for review February 8, 2021 22:37
@Paulinakhew Paulinakhew changed the title [WIP] Add application credit Add application credit Feb 8, 2021
Comment thread shopify/resources/application_credit.py Outdated
if application_credit_id:
return "%s/application_credits/%s" % (cls.site, application_credit_id)
else:
return "%s" % (cls.site)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh I'm not sure if this part is right... this was how I got it to return the site with /application_credits tacked onto the end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overloading the _prefix isn't necessary here, it's only needed for resources that can be conditionally accessed at different routes, e.g. variants can be accessed from /admin/#{product_id}/#{variant_id}, or simply /admin/#{variant_id}.

Comment thread shopify/resources/application_credit.py Outdated
from ..base import ShopifyResource

class ApplicationCredit(ShopifyResource):
_prefix_source = "application_credits/$application_credit_id/"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe you need to specify this and add logic for the _prefix, pyactiveresource will default to application_credits/$id naturally. A pass here should still work

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for pass, check out the implementation in the Ruby client library: https://github.com/Shopify/shopify_api/blob/master/lib/shopify_api/resources/application_credit.rb

pyactiveresource should be able to do all of the heavy lifting here with no special logic

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay thank you so much @mllemango @jamiemtdwyer

@Paulinakhew
Paulinakhew requested a review from mllemango February 9, 2021 22:24

@mllemango mllemango left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the tests!

@Paulinakhew
Paulinakhew merged commit b539359 into master Feb 10, 2021
@Paulinakhew
Paulinakhew deleted the paulinakhew-add-applicationcredit branch February 10, 2021 16:02
@NabeelAhsen NabeelAhsen mentioned this pull request Mar 17, 2021
2 tasks done

This branch had an error being deployed

1 failed deployment
pypi — 7fb29968 Deployed Apr 9, 2024 by shopify-shipit[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing support for ApplicationCredit

4 participants